home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / bosco.c < prev    next >
C/C++ Source or Header  |  2000-05-04  |  27KB  |  737 lines

  1. /***************************************************************************
  2.  
  3. Bosconian
  4.  
  5. driver by Martin Scragg
  6.  
  7.  
  8. CPU #1:
  9. 0000-3fff ROM
  10. CPU #2:
  11. 0000-1fff ROM
  12. CPU #3:
  13. 0000-1fff ROM
  14. ALL CPUS:
  15. 8000-83ff Video RAM
  16. 8400-87ff Color RAM
  17. 8b80-8bff sprite code/color
  18. 9380-93ff sprite position
  19. 9b80-9bff sprite control
  20. 8800-9fff RAM
  21.  
  22. read:
  23. 6800-6807 dip switches (only bits 0 and 1 are used - bit 0 is DSW1, bit 1 is DSW2)
  24.       dsw1:
  25.         bit 6-7 lives
  26.         bit 3-5 bonus
  27.         bit 0-2 coins per play
  28.           dsw2: (bootleg version, the original version is slightly different)
  29.             bit 7 cocktail/upright (1 = upright)
  30.         bit 6 ?
  31.         bit 5 RACK TEST
  32.         bit 4 pause (0 = paused, 1 = not paused)
  33.         bit 3 ?
  34.         bit 2 ?
  35.         bit 0-1 difficulty
  36. 7000-      custom IO chip return values
  37. 7100      custom IO chip status ($10 = command executed)
  38.  
  39. write:
  40. 6805      sound voice 1 waveform (nibble)
  41. 6811-6813 sound voice 1 frequency (nibble)
  42. 6815      sound voice 1 volume (nibble)
  43. 680a      sound voice 2 waveform (nibble)
  44. 6816-6818 sound voice 2 frequency (nibble)
  45. 681a      sound voice 2 volume (nibble)
  46. 680f      sound voice 3 waveform (nibble)
  47. 681b-681d sound voice 3 frequency (nibble)
  48. 681f      sound voice 3 volume (nibble)
  49. 6820      cpu #1 irq acknowledge/enable
  50. 6821      cpu #2 irq acknowledge/enable
  51. 6822      cpu #3 nmi acknowledge/enable
  52. 6823      if 0, halt CPU #2 and #3
  53. 6830      Watchdog reset?
  54. 7000-      custom IO chip parameters
  55. 7100      custom IO chip command (see machine/bosco.c for more details)
  56. a000-a002 starfield scroll direction/speed (only bit 0 is significant)
  57. a003-a005 starfield blink?
  58. a007      flip screen
  59.  
  60. Interrupts:
  61. CPU #1 IRQ mode 1
  62.        NMI is triggered by the custom IO chip to signal the CPU to read/write
  63.            parameters
  64. CPU #2 IRQ mode 1
  65. CPU #3 NMI (@120Hz)
  66.  
  67. ***************************************************************************/
  68.  
  69. #include "driver.h"
  70. #include "vidhrdw/generic.h"
  71.  
  72. extern unsigned char *bosco_sharedram;
  73. READ_HANDLER( bosco_sharedram_r );
  74. WRITE_HANDLER( bosco_sharedram_w );
  75. READ_HANDLER( bosco_dsw_r );
  76. WRITE_HANDLER( bosco_interrupt_enable_1_w );
  77. WRITE_HANDLER( bosco_interrupt_enable_2_w );
  78. WRITE_HANDLER( bosco_interrupt_enable_3_w );
  79. WRITE_HANDLER( bosco_halt_w );
  80. READ_HANDLER( bosco_customio_1_r );
  81. READ_HANDLER( bosco_customio_2_r );
  82. WRITE_HANDLER( bosco_customio_1_w );
  83. WRITE_HANDLER( bosco_customio_2_w );
  84. READ_HANDLER( bosco_customio_data_1_r );
  85. READ_HANDLER( bosco_customio_data_2_r );
  86. WRITE_HANDLER( bosco_customio_data_1_w );
  87. WRITE_HANDLER( bosco_customio_data_2_w );
  88. int  bosco_interrupt_1(void);
  89. int  bosco_interrupt_2(void);
  90. int  bosco_interrupt_3(void);
  91. void bosco_init_machine(void);
  92.  
  93. WRITE_HANDLER( bosco_cpu_reset_w );
  94. int  bosco_vh_start(void);
  95. void bosco_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  96. void bosco_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  97.  
  98. extern unsigned char *bosco_videoram2,*bosco_colorram2;
  99. extern unsigned char *bosco_radarx,*bosco_radary,*bosco_radarattr;
  100. extern size_t bosco_radarram_size;
  101. extern unsigned char *bosco_staronoff;
  102. extern unsigned char *bosco_starblink;
  103. WRITE_HANDLER( bosco_videoram2_w );
  104. WRITE_HANDLER( bosco_colorram2_w );
  105. WRITE_HANDLER( bosco_flipscreen_w );
  106. WRITE_HANDLER( bosco_scrollx_w );
  107. WRITE_HANDLER( bosco_scrolly_w );
  108. WRITE_HANDLER( bosco_starcontrol_w );
  109. int  bosco_vh_start(void);
  110. void bosco_vh_stop(void);
  111. void bosco_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  112.  
  113. WRITE_HANDLER( pengo_sound_w );
  114. int  bosco_sh_start(const struct MachineSound *msound);
  115. void bosco_sh_stop(void);
  116. extern unsigned char *pengo_soundregs;
  117.  
  118.  
  119. static struct MemoryReadAddress readmem_cpu1[] =
  120. {
  121.     { 0x0000, 0x3fff, MRA_ROM },
  122.     { 0x6800, 0x6807, bosco_dsw_r },
  123.     { 0x7000, 0x700f, bosco_customio_data_1_r },
  124.     { 0x7100, 0x7100, bosco_customio_1_r },
  125.     { 0x7800, 0x97ff, bosco_sharedram_r },
  126.     { -1 }    /* end of table */
  127. };
  128.  
  129. static struct MemoryReadAddress readmem_cpu2[] =
  130. {
  131.     { 0x0000, 0x1fff, MRA_ROM },
  132.     { 0x6800, 0x6807, bosco_dsw_r },
  133.     { 0x9000, 0x900f, bosco_customio_data_2_r },
  134.     { 0x9100, 0x9100, bosco_customio_2_r },
  135.     { 0x7800, 0x97ff, bosco_sharedram_r },
  136.     { -1 }    /* end of table */
  137. };
  138.  
  139. static struct MemoryReadAddress readmem_cpu3[] =
  140. {
  141.     { 0x0000, 0x1fff, MRA_ROM },
  142.     { 0x6800, 0x6807, bosco_dsw_r },
  143.     { 0x7800, 0x97ff, bosco_sharedram_r },
  144.     { -1 }    /* end of table */
  145. };
  146.  
  147. static struct MemoryWriteAddress writemem_cpu1[] =
  148. {
  149.     { 0x0000, 0x3fff, MWA_ROM },
  150.     { 0x6800, 0x681f, pengo_sound_w, &pengo_soundregs },
  151.     { 0x6820, 0x6820, bosco_interrupt_enable_1_w },
  152.     { 0x6822, 0x6822, bosco_interrupt_enable_3_w },
  153.     { 0x6823, 0x6823, bosco_halt_w },
  154.     { 0x6830, 0x6830, watchdog_reset_w },
  155.     { 0x7000, 0x700f, bosco_customio_data_1_w },
  156.     { 0x7100, 0x7100, bosco_customio_1_w },
  157.  
  158.     { 0x8000, 0x83ff, videoram_w, &videoram, &videoram_size },
  159.     { 0x8400, 0x87ff, bosco_videoram2_w, &bosco_videoram2 },
  160.     { 0x8800, 0x8bff, colorram_w, &colorram },
  161.     { 0x8c00, 0x8fff, bosco_colorram2_w, &bosco_colorram2 },
  162.  
  163.     { 0x7800, 0x97ff, bosco_sharedram_w, &bosco_sharedram },
  164.  
  165.     { 0x83d4, 0x83df, MWA_RAM, &spriteram, &spriteram_size },    /* these are here just to initialize */
  166.     { 0x8bd4, 0x8bdf, MWA_RAM, &spriteram_2 },            /* the pointers. */
  167.     { 0x83f4, 0x83ff, MWA_RAM, &bosco_radarx, &bosco_radarram_size },    /* ditto */
  168.     { 0x8bf4, 0x8bff, MWA_RAM, &bosco_radary },
  169.  
  170.     { 0x9810, 0x9810, bosco_scrollx_w },
  171.     { 0x9820, 0x9820, bosco_scrolly_w },
  172.     { 0x9830, 0x9830, bosco_starcontrol_w },
  173.     { 0x9840, 0x9840, MWA_RAM, &bosco_staronoff },
  174.     { 0x9870, 0x9870, bosco_flipscreen_w },
  175.     { 0x9804, 0x980f, MWA_RAM, &bosco_radarattr },
  176.     { -1 }    /* end of table */
  177. };
  178.  
  179. static struct MemoryWriteAddress writemem_cpu2[] =
  180. {
  181.     { 0x0000, 0x1fff, MWA_ROM },
  182.     { 0x6821, 0x6821, bosco_interrupt_enable_2_w },
  183.  
  184.     { 0x8000, 0x83ff, videoram_w },
  185.     { 0x8400, 0x87ff, bosco_videoram2_w },
  186.     { 0x8800, 0x8bff, colorram_w },
  187.     { 0x8c00, 0x8fff, bosco_colorram2_w },
  188.     { 0x9000, 0x900f, bosco_customio_data_2_w },
  189.     { 0x9100, 0x9100, bosco_customio_2_w },
  190.     { 0x7800, 0x97ff, bosco_sharedram_w },
  191.  
  192.     { 0x9810, 0x9810, bosco_scrollx_w },
  193.     { 0x9820, 0x9820, bosco_scrolly_w },
  194.     { 0x9830, 0x9830, bosco_starcontrol_w },
  195.     { 0x9874, 0x9875, MWA_RAM, &bosco_starblink },
  196.     { -1 }    /* end of table */
  197. };
  198.  
  199. static struct MemoryWriteAddress writemem_cpu3[] =
  200. {
  201.     { 0x0000, 0x1fff, MWA_ROM },
  202.     { 0x6800, 0x681f, pengo_sound_w },
  203.     { 0x6822, 0x6822, bosco_interrupt_enable_3_w },
  204.  
  205.     { 0x8000, 0x83ff, videoram_w },
  206.     { 0x8400, 0x87ff, bosco_videoram2_w },
  207.     { 0x8800, 0x8bff, colorram_w },
  208.     { 0x8c00, 0x8fff, bosco_colorram2_w },
  209.     { 0x7800, 0x97ff, bosco_sharedram_w },
  210.     { -1 }    /* end of table */
  211. };
  212.  
  213.  
  214.  
  215. INPUT_PORTS_START( bosco )
  216.     PORT_START    /* DSW0 */
  217.     PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
  218.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
  219.     PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
  220.     PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
  221.     PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
  222.     PORT_DIPSETTING(    0x04, DEF_STR( 2C_3C ) )
  223.     PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
  224.     PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
  225.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  226.     /* TODO: bonus scores are different for 5 lives */
  227.     PORT_DIPNAME( 0x38, 0x08, "Bonus Fighter" )
  228.     PORT_DIPSETTING(    0x30, "15K 50K" )
  229.     PORT_DIPSETTING(    0x38, "20K 70K" )
  230.     PORT_DIPSETTING(    0x08, "10K 50K 50K" )
  231.     PORT_DIPSETTING(    0x10, "15K 50K 50K" )
  232.     PORT_DIPSETTING(    0x18, "15K 70K 70K" )
  233.     PORT_DIPSETTING(    0x20, "20K 70K 70K" )
  234.     PORT_DIPSETTING(    0x28, "30K 100K 100K" )
  235.     PORT_DIPSETTING(    0x00, "None" )
  236.     PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Lives ) )
  237.     PORT_DIPSETTING(    0x00, "1" )
  238.     PORT_DIPSETTING(    0x40, "2" )
  239.     PORT_DIPSETTING(    0x80, "3" )
  240.     PORT_DIPSETTING(    0xc0, "5" )
  241.  
  242.     PORT_START    /* DSW1 */
  243.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
  244.     PORT_DIPSETTING(    0x01, "Easy" )
  245.     PORT_DIPSETTING(    0x03, "Medium" )
  246.     PORT_DIPSETTING(    0x02, "Hardest" )
  247.     PORT_DIPSETTING(    0x00, "Auto" )
  248.     PORT_DIPNAME( 0x04, 0x04, "2 Credits Game" )
  249.     PORT_DIPSETTING(    0x00, "1 Player" )
  250.     PORT_DIPSETTING(    0x04, "2 Players" )
  251.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) )
  252.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  253.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  254.     PORT_DIPNAME( 0x10, 0x10, "Freeze" )
  255.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  256.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  257.     PORT_DIPNAME( 0x20, 0x20, "Allow Continue" )
  258.     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
  259.     PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
  260.     PORT_DIPNAME( 0x40, 0x40, "Test ????" )
  261.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  262.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  263.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
  264.     PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
  265.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  266.  
  267.     PORT_START    /* FAKE */
  268.     /* The player inputs are not memory mapped, they are handled by an I/O chip. */
  269.     /* These fake input ports are read by galaga_customio_data_r() */
  270.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  271.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  272.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  273.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  274.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1, 1 )
  275.     PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_BUTTON1, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
  276.     PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
  277.  
  278.     PORT_START    /* FAKE */
  279.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL)
  280.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL)
  281.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL)
  282.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL)
  283.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL, 1 )
  284.     PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
  285.     PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
  286.  
  287.     PORT_START    /* FAKE */
  288.     /* the button here is used to trigger the sound in the test screen */
  289.     PORT_BITX(0x03, IP_ACTIVE_LOW, IPT_BUTTON1,    0, IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  290.     PORT_BIT_IMPULSE( 0x04, IP_ACTIVE_LOW, IPT_START1, 1 )
  291.     PORT_BIT_IMPULSE( 0x08, IP_ACTIVE_LOW, IPT_START2, 1 )
  292.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_LOW, IPT_COIN1, 1 )
  293.     PORT_BIT_IMPULSE( 0x20, IP_ACTIVE_LOW, IPT_COIN2, 1 )
  294.     PORT_BIT_IMPULSE( 0x40, IP_ACTIVE_LOW, IPT_COIN3, 1 )
  295.     PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
  296. INPUT_PORTS_END
  297.  
  298. INPUT_PORTS_START( boscomd )
  299.     PORT_START    /* DSW0 */
  300.     PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
  301.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
  302.     PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
  303.     PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
  304.     PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
  305.     PORT_DIPSETTING(    0x04, DEF_STR( 2C_3C ) )
  306.     PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
  307.     PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
  308.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  309.     /* TODO: bonus scores are different for 5 lives */
  310.     PORT_DIPNAME( 0x38, 0x08, "Bonus Fighter" )
  311.     PORT_DIPSETTING(    0x30, "15K 50K" )
  312.     PORT_DIPSETTING(    0x38, "20K 70K" )
  313.     PORT_DIPSETTING(    0x08, "10K 50K 50K" )
  314.     PORT_DIPSETTING(    0x10, "15K 50K 50K" )
  315.     PORT_DIPSETTING(    0x18, "15K 70K 70K" )
  316.     PORT_DIPSETTING(    0x20, "20K 70K 70K" )
  317.     PORT_DIPSETTING(    0x28, "30K 100K 100K" )
  318.     PORT_DIPSETTING(    0x00, "None" )
  319.     PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Lives ) )
  320.     PORT_DIPSETTING(    0x00, "1" )
  321.     PORT_DIPSETTING(    0x40, "2" )
  322.     PORT_DIPSETTING(    0x80, "3" )
  323.     PORT_DIPSETTING(    0xc0, "5" )
  324.  
  325.     PORT_START    /* DSW1 */
  326.     PORT_DIPNAME( 0x01, 0x01, "2 Credits Game" )
  327.     PORT_DIPSETTING(    0x00, "1 Player" )
  328.     PORT_DIPSETTING(    0x01, "2 Players" )
  329.     PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) )
  330.     PORT_DIPSETTING(    0x02, "Easy" )
  331.     PORT_DIPSETTING(    0x06, "Medium" )
  332.     PORT_DIPSETTING(    0x04, "Hardest" )
  333.     PORT_DIPSETTING(    0x00, "Auto" )
  334.     PORT_DIPNAME( 0x08, 0x08, "Allow Continue" )
  335.     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
  336.     PORT_DIPSETTING(    0x08, DEF_STR( Yes ) )
  337.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Demo_Sounds ) )
  338.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  339.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  340.     PORT_DIPNAME( 0x20, 0x20, "Freeze" )
  341.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  342.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  343.     PORT_DIPNAME( 0x40, 0x40, "Test ????" )
  344.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  345.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  346.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
  347.     PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
  348.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  349.  
  350.     PORT_START    /* FAKE */
  351.     /* The player inputs are not memory mapped, they are handled by an I/O chip. */
  352.     /* These fake input ports are read by galaga_customio_data_r() */
  353.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  354.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  355.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  356.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  357.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1, 1 )
  358.     PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_BUTTON1, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
  359.     PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
  360.  
  361.     PORT_START    /* FAKE */
  362.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL)
  363.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL)
  364.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL)
  365.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL)
  366.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL, 1 )
  367.     PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
  368.     PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
  369.  
  370.     PORT_START    /* FAKE */
  371.     /* the button here is used to trigger the sound in the test screen */
  372.     PORT_BITX(0x03, IP_ACTIVE_LOW, IPT_BUTTON1,    0, IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  373.     PORT_BIT_IMPULSE( 0x04, IP_ACTIVE_LOW, IPT_START1, 1 )
  374.     PORT_BIT_IMPULSE( 0x08, IP_ACTIVE_LOW, IPT_START2, 1 )
  375.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_LOW, IPT_COIN1, 1 )
  376.     PORT_BIT_IMPULSE( 0x20, IP_ACTIVE_LOW, IPT_COIN2, 1 )
  377.     PORT_BIT_IMPULSE( 0x40, IP_ACTIVE_LOW, IPT_COIN3, 1 )
  378.     PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
  379. INPUT_PORTS_END
  380.  
  381.  
  382.  
  383. static struct GfxLayout charlayout =
  384. {
  385.     8,8,    /* 8*8 characters */
  386.     256,    /* 256 characters */
  387.     2,    /* 2 bits per pixel */
  388.     { 0, 4 },      /* the two bitplanes for 4 pixels are packed into one byte */
  389.     { 8*8+0, 8*8+1, 8*8+2, 8*8+3, 0, 1, 2, 3 },   /* bits are packed in groups of four */
  390.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },   /* characters are rotated 90 degrees */
  391.     16*8           /* every char takes 16 bytes */
  392. };
  393.  
  394. static struct GfxLayout spritelayout =
  395. {
  396.     16,16,        /* 16*16 sprites */
  397.     64,        /* 128 sprites */
  398.     2,        /* 2 bits per pixel */
  399.     { 0, 4 },    /* the two bitplanes for 4 pixels are packed into one byte */
  400.     { 8*8, 8*8+1, 8*8+2, 8*8+3, 16*8+0, 16*8+1, 16*8+2, 16*8+3,
  401.             24*8+0, 24*8+1, 24*8+2, 24*8+3, 0, 1, 2, 3  },
  402.     { 0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8,
  403.             32 * 8, 33 * 8, 34 * 8, 35 * 8, 36 * 8, 37 * 8, 38 * 8, 39 * 8 },
  404.     64*8    /* every sprite takes 64 bytes */
  405. };
  406.  
  407. static struct GfxLayout dotlayout =
  408. {
  409.     4,4,    /* 4*4 characters */
  410.     8,    /* 8 characters */
  411.     2,    /* 2 bits per pixel */
  412.     { 6, 7 },
  413.     { 3*8, 2*8, 1*8, 0*8 },
  414.     { 3*32, 2*32, 1*32, 0*32 },
  415.     16*8    /* every char takes 16 consecutive bytes */
  416. };
  417.  
  418. static struct GfxDecodeInfo gfxdecodeinfo[] =
  419. {
  420.     { REGION_GFX1, 0, &charlayout,            0, 64 },
  421.     { REGION_GFX2, 0, &spritelayout,     64*4, 64 },
  422.     { REGION_GFX3, 0, &dotlayout,    64*4+64*4,    1 },
  423.     { -1 } /* end of array */
  424. };
  425.  
  426.  
  427.  
  428. static struct namco_interface namco_interface =
  429. {
  430.     3072000/32,    /* sample rate */
  431.     3,            /* number of voices */
  432.     50,            /* playback volume */
  433.     REGION_SOUND1    /* memory region */
  434. };
  435.  
  436.  
  437. static const char *bosco_sample_names[] =
  438. {
  439.     "*bosco",
  440.     "midbang.wav",
  441.     "bigbang.wav",
  442.     "shot.wav",
  443.     0    /* end of array */
  444. };
  445.  
  446. static struct Samplesinterface samples_interface =
  447. {
  448.     3,    /* 3 channels */
  449.     80,    /* volume */
  450.     bosco_sample_names
  451. };
  452.  
  453.  
  454. static struct CustomSound_interface custom_interface =
  455. {
  456.     bosco_sh_start,
  457.     bosco_sh_stop,
  458.     0
  459. };
  460.  
  461.  
  462. static struct MachineDriver machine_driver_bosco =
  463. {
  464.     /* basic machine hardware */
  465.     {
  466.         {
  467.             CPU_Z80,
  468.             3125000,    /* 3.125 Mhz */
  469.             readmem_cpu1,writemem_cpu1,0,0,
  470.             bosco_interrupt_1,1
  471.         },
  472.         {
  473.             CPU_Z80,
  474.             3125000,    /* 3.125 Mhz */
  475.             readmem_cpu2,writemem_cpu2,0,0,
  476.             bosco_interrupt_2,1
  477.         },
  478.         {
  479.             CPU_Z80,
  480.             3125000,    /* 3.125 Mhz */
  481.             readmem_cpu3,writemem_cpu3,0,0,
  482.             bosco_interrupt_3,2
  483.         }
  484.     },
  485.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  486.     100,    /* 100 CPU slices per frame - an high value to ensure proper */
  487.             /* synchronization of the CPUs */
  488.     bosco_init_machine,
  489.  
  490.     /* video hardware */
  491.     36*8, 28*8, { 0*8, 36*8-1, 0*8, 28*8-1 },
  492.     gfxdecodeinfo,
  493.     32+64,64*4+64*4+4,    /* 32 for the characters, 64 for the stars */
  494.     bosco_vh_convert_color_prom,
  495.  
  496.     VIDEO_TYPE_RASTER,
  497.     0,
  498.     bosco_vh_start,
  499.     bosco_vh_stop,
  500.     bosco_vh_screenrefresh,
  501.  
  502.     /* sound hardware */
  503.     0,0,0,0,
  504.     {
  505.         {
  506.             SOUND_NAMCO,
  507.             &namco_interface
  508.         },
  509.         {
  510.             SOUND_CUSTOM,
  511.             &custom_interface
  512.         },
  513.         {
  514.             SOUND_SAMPLES,
  515.             &samples_interface
  516.         }
  517.     }
  518. };
  519.  
  520.  
  521.  
  522.  
  523.  
  524. /***************************************************************************
  525.  
  526.   Game driver(s)
  527.  
  528. ***************************************************************************/
  529.  
  530. ROM_START( bosco )
  531.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code for the first CPU  */
  532.     ROM_LOAD( "bos3_1.bin",   0x0000, 0x1000, 0x96021267 )
  533.     ROM_LOAD( "bos1_2.bin",   0x1000, 0x1000, 0x2d8f3ebe )
  534.     ROM_LOAD( "bos1_3.bin",   0x2000, 0x1000, 0xc80ccfa5 )
  535.     ROM_LOAD( "bos1_4b.bin",  0x3000, 0x1000, 0xa3f7f4ab )
  536.  
  537.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the second CPU */
  538.     ROM_LOAD( "bos1_5c.bin",  0x0000, 0x1000, 0xa7c8e432 )
  539.     ROM_LOAD( "bos3_6.bin",   0x1000, 0x1000, 0x4543cf82 )
  540.  
  541.     ROM_REGION( 0x10000, REGION_CPU3 )    /* 64k for the third CPU  */
  542.     ROM_LOAD( "2900.3e",      0x0000, 0x1000, 0xd45a4911 )
  543.  
  544.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  545.     ROM_LOAD( "5300.5d",      0x0000, 0x1000, 0xa956d3c5 )
  546.  
  547.     ROM_REGION( 0x1000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  548.     ROM_LOAD( "5200.5e",      0x0000, 0x1000, 0xe869219c )
  549.  
  550.     ROM_REGION( 0x0100, REGION_GFX3 | REGIONFLAG_DISPOSE )
  551.     ROM_LOAD( "prom.2d",      0x0000, 0x0100, 0x9b69b543 )    /* dots */
  552.  
  553.     ROM_REGION( 0x0260, REGION_PROMS )
  554.     ROM_LOAD( "bosco.6b",     0x0000, 0x0020, 0xd2b96fb0 )    /* palette */
  555.     ROM_LOAD( "bosco.4m",     0x0020, 0x0100, 0x4e15d59c )    /* lookup table */
  556.     ROM_LOAD( "prom.1d",      0x0120, 0x0100, 0xde2316c6 )    /* ?? */
  557.     ROM_LOAD( "prom.2r",      0x0220, 0x0020, 0xb88d5ba9 )    /* ?? */
  558.     ROM_LOAD( "prom.7h",      0x0240, 0x0020, 0x87d61353 )    /* ?? */
  559.  
  560.     ROM_REGION( 0x0200, REGION_SOUND1 )    /* sound prom */
  561.     ROM_LOAD( "bosco.spr",    0x0000, 0x0100, 0xee8ca3a8 )
  562.     ROM_LOAD( "prom.5c",      0x0100, 0x0100, 0x77245b66 )    /* timing - not used */
  563.  
  564.     ROM_REGION( 0x3000, REGION_SOUND2 )    /* ROMs for digitised speech */
  565.     ROM_LOAD( "4900.5n",      0x0000, 0x1000, 0x09acc978 )
  566.     ROM_LOAD( "5000.5m",      0x1000, 0x1000, 0xe571e959 )
  567.     ROM_LOAD( "5100.5l",      0x2000, 0x1000, 0x17ac9511 )
  568. ROM_END
  569.  
  570. ROM_START( boscoo )
  571.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code for the first CPU  */
  572.     ROM_LOAD( "bos1_1.bin",   0x0000, 0x1000, 0x0d9920e7 )
  573.     ROM_LOAD( "bos1_2.bin",   0x1000, 0x1000, 0x2d8f3ebe )
  574.     ROM_LOAD( "bos1_3.bin",   0x2000, 0x1000, 0xc80ccfa5 )
  575.     ROM_LOAD( "bos1_4b.bin",  0x3000, 0x1000, 0xa3f7f4ab )
  576.  
  577.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the second CPU */
  578.     ROM_LOAD( "bos1_5c.bin",  0x0000, 0x1000, 0xa7c8e432 )
  579.     ROM_LOAD( "2800.3h",      0x1000, 0x1000, 0x31b8c648 )
  580.  
  581.     ROM_REGION( 0x10000, REGION_CPU3 )    /* 64k for the third CPU  */
  582.     ROM_LOAD( "2900.3e",      0x0000, 0x1000, 0xd45a4911 )
  583.  
  584.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  585.     ROM_LOAD( "5300.5d",      0x0000, 0x1000, 0xa956d3c5 )
  586.  
  587.     ROM_REGION( 0x1000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  588.     ROM_LOAD( "5200.5e",      0x0000, 0x1000, 0xe869219c )
  589.  
  590.     ROM_REGION( 0x0100, REGION_GFX3 | REGIONFLAG_DISPOSE )
  591.     ROM_LOAD( "prom.2d",      0x0000, 0x0100, 0x9b69b543 )    /* dots */
  592.  
  593.     ROM_REGION( 0x0260, REGION_PROMS )
  594.     ROM_LOAD( "bosco.6b",     0x0000, 0x0020, 0xd2b96fb0 )    /* palette */
  595.     ROM_LOAD( "bosco.4m",     0x0020, 0x0100, 0x4e15d59c )    /* lookup table */
  596.     ROM_LOAD( "prom.1d",      0x0120, 0x0100, 0xde2316c6 )    /* ?? */
  597.     ROM_LOAD( "prom.2r",      0x0220, 0x0020, 0xb88d5ba9 )    /* ?? */
  598.     ROM_LOAD( "prom.7h",      0x0240, 0x0020, 0x87d61353 )    /* ?? */
  599.  
  600.     ROM_REGION( 0x0200, REGION_SOUND1 )    /* sound prom */
  601.     ROM_LOAD( "bosco.spr",    0x0000, 0x0100, 0xee8ca3a8 )
  602.     ROM_LOAD( "prom.5c",      0x0100, 0x0100, 0x77245b66 )    /* timing - not used */
  603.  
  604.     ROM_REGION( 0x3000, REGION_SOUND2 )    /* ROMs for digitised speech */
  605.     ROM_LOAD( "4900.5n",      0x0000, 0x1000, 0x09acc978 )
  606.     ROM_LOAD( "5000.5m",      0x1000, 0x1000, 0xe571e959 )
  607.     ROM_LOAD( "5100.5l",      0x2000, 0x1000, 0x17ac9511 )
  608. ROM_END
  609.  
  610. ROM_START( boscoo2 )
  611.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code for the first CPU  */
  612.     ROM_LOAD( "bos1_1.bin",   0x0000, 0x1000, 0x0d9920e7 )
  613.     ROM_LOAD( "bos1_2.bin",   0x1000, 0x1000, 0x2d8f3ebe )
  614.     ROM_LOAD( "bos1_3.bin",   0x2000, 0x1000, 0xc80ccfa5 )
  615.     ROM_LOAD( "bos1_4.3k",    0x3000, 0x1000, 0x7ebea2b8 )
  616.  
  617.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the second CPU */
  618.     ROM_LOAD( "bos1_5b.3j",   0x0000, 0x1000, 0x3d6955a8 )
  619.     ROM_LOAD( "2800.3h",      0x1000, 0x1000, 0x31b8c648 )
  620.  
  621.     ROM_REGION( 0x10000, REGION_CPU3 )    /* 64k for the third CPU  */
  622.     ROM_LOAD( "2900.3e",      0x0000, 0x1000, 0xd45a4911 )
  623.  
  624.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  625.     ROM_LOAD( "5300.5d",      0x0000, 0x1000, 0xa956d3c5 )
  626.  
  627.     ROM_REGION( 0x1000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  628.     ROM_LOAD( "5200.5e",      0x0000, 0x1000, 0xe869219c )
  629.  
  630.     ROM_REGION( 0x0100, REGION_GFX3 | REGIONFLAG_DISPOSE )
  631.     ROM_LOAD( "prom.2d",      0x0000, 0x0100, 0x9b69b543 )    /* dots */
  632.  
  633.     ROM_REGION( 0x0260, REGION_PROMS )
  634.     ROM_LOAD( "bosco.6b",     0x0000, 0x0020, 0xd2b96fb0 )    /* palette */
  635.     ROM_LOAD( "bosco.4m",     0x0020, 0x0100, 0x4e15d59c )    /* lookup table */
  636.     ROM_LOAD( "prom.1d",      0x0120, 0x0100, 0xde2316c6 )    /* ?? */
  637.     ROM_LOAD( "prom.2r",      0x0220, 0x0020, 0xb88d5ba9 )    /* ?? */
  638.     ROM_LOAD( "prom.7h",      0x0240, 0x0020, 0x87d61353 )    /* ?? */
  639.  
  640.     ROM_REGION( 0x0200, REGION_SOUND1 )    /* sound prom */
  641.     ROM_LOAD( "bosco.spr",    0x0000, 0x0100, 0xee8ca3a8 )
  642.     ROM_LOAD( "prom.5c",      0x0100, 0x0100, 0x77245b66 )    /* timing - not used */
  643.  
  644.     ROM_REGION( 0x3000, REGION_SOUND2 )    /* ROMs for digitised speech */
  645.     ROM_LOAD( "4900.5n",      0x0000, 0x1000, 0x09acc978 )
  646.     ROM_LOAD( "5000.5m",      0x1000, 0x1000, 0xe571e959 )
  647.     ROM_LOAD( "5100.5l",      0x2000, 0x1000, 0x17ac9511 )
  648. ROM_END
  649.  
  650. ROM_START( boscomd )
  651.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code for the first CPU  */
  652.     ROM_LOAD( "3n",       0x0000, 0x1000, 0x441b501a )
  653.     ROM_LOAD( "3m",       0x1000, 0x1000, 0xa3c5c7ef )
  654.     ROM_LOAD( "3l",       0x2000, 0x1000, 0x6ca9a0cf )
  655.     ROM_LOAD( "3k",       0x3000, 0x1000, 0xd83bacc5 )
  656.  
  657.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the second CPU */
  658.     ROM_LOAD( "3j",       0x0000, 0x1000, 0x4374e39a )
  659.     ROM_LOAD( "3h",       0x1000, 0x1000, 0x04e9fcef )
  660.  
  661.     ROM_REGION( 0x10000, REGION_CPU3 )    /* 64k for the third CPU  */
  662.     ROM_LOAD( "2900.3e",      0x0000, 0x1000, 0xd45a4911 )
  663.  
  664.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  665.     ROM_LOAD( "5300.5d",      0x0000, 0x1000, 0xa956d3c5 )
  666.  
  667.     ROM_REGION( 0x1000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  668.     ROM_LOAD( "5200.5e",      0x0000, 0x1000, 0xe869219c )
  669.  
  670.     ROM_REGION( 0x0100, REGION_GFX3 | REGIONFLAG_DISPOSE )
  671.     ROM_LOAD( "prom.2d",      0x0000, 0x0100, 0x9b69b543 )    /* dots */
  672.  
  673.     ROM_REGION( 0x0260, REGION_PROMS )
  674.     ROM_LOAD( "bosco.6b",     0x0000, 0x0020, 0xd2b96fb0 )    /* palette */
  675.     ROM_LOAD( "bosco.4m",     0x0020, 0x0100, 0x4e15d59c )    /* lookup table */
  676.     ROM_LOAD( "prom.1d",      0x0120, 0x0100, 0xde2316c6 )    /* ?? */
  677.     ROM_LOAD( "prom.2r",      0x0220, 0x0020, 0xb88d5ba9 )    /* ?? */
  678.     ROM_LOAD( "prom.7h",      0x0240, 0x0020, 0x87d61353 )    /* ?? */
  679.  
  680.     ROM_REGION( 0x0200, REGION_SOUND1 )    /* sound prom */
  681.     ROM_LOAD( "bosco.spr",    0x0000, 0x0100, 0xee8ca3a8 )
  682.     ROM_LOAD( "prom.5c",      0x0100, 0x0100, 0x77245b66 )    /* timing - not used */
  683.  
  684.     ROM_REGION( 0x3000, REGION_SOUND2 )    /* ROMs for digitised speech */
  685.     ROM_LOAD( "4900.5n",      0x0000, 0x1000, 0x09acc978 )
  686.     ROM_LOAD( "5000.5m",      0x1000, 0x1000, 0xe571e959 )
  687.     ROM_LOAD( "5100.5l",      0x2000, 0x1000, 0x17ac9511 )
  688. ROM_END
  689.  
  690. ROM_START( boscomdo )
  691.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code for the first CPU  */
  692.     ROM_LOAD( "2300.3n",      0x0000, 0x1000, 0xdb6128b0 )
  693.     ROM_LOAD( "2400.3m",      0x1000, 0x1000, 0x86907614 )
  694.     ROM_LOAD( "2500.3l",      0x2000, 0x1000, 0xa21fae11 )
  695.     ROM_LOAD( "2600.3k",      0x3000, 0x1000, 0x11d6ae23 )
  696.  
  697.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the second CPU */
  698.     ROM_LOAD( "2700.3j",      0x0000, 0x1000, 0x7254e65e )
  699.     ROM_LOAD( "2800.3h",      0x1000, 0x1000, 0x31b8c648 )
  700.  
  701.     ROM_REGION( 0x10000, REGION_CPU3 )    /* 64k for the third CPU  */
  702.     ROM_LOAD( "2900.3e",      0x0000, 0x1000, 0xd45a4911 )
  703.  
  704.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  705.     ROM_LOAD( "5300.5d",      0x0000, 0x1000, 0xa956d3c5 )
  706.  
  707.     ROM_REGION( 0x1000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  708.     ROM_LOAD( "5200.5e",      0x0000, 0x1000, 0xe869219c )
  709.  
  710.     ROM_REGION( 0x0100, REGION_GFX3 | REGIONFLAG_DISPOSE )
  711.     ROM_LOAD( "prom.2d",      0x0000, 0x0100, 0x9b69b543 )    /* dots */
  712.  
  713.     ROM_REGION( 0x0260, REGION_PROMS )
  714.     ROM_LOAD( "bosco.6b",     0x0000, 0x0020, 0xd2b96fb0 )    /* palette */
  715.     ROM_LOAD( "bosco.4m",     0x0020, 0x0100, 0x4e15d59c )    /* lookup table */
  716.     ROM_LOAD( "prom.1d",      0x0120, 0x0100, 0xde2316c6 )    /* ?? */
  717.     ROM_LOAD( "prom.2r",      0x0220, 0x0020, 0xb88d5ba9 )    /* ?? */
  718.     ROM_LOAD( "prom.7h",      0x0240, 0x0020, 0x87d61353 )    /* ?? */
  719.  
  720.     ROM_REGION( 0x0200, REGION_SOUND1 )    /* sound prom */
  721.     ROM_LOAD( "bosco.spr",    0x0000, 0x0100, 0xee8ca3a8 )
  722.     ROM_LOAD( "prom.5c",      0x0100, 0x0100, 0x77245b66 )    /* timing - not used */
  723.  
  724.     ROM_REGION( 0x3000, REGION_SOUND2 )    /* ROMs for digitised speech */
  725.     ROM_LOAD( "4900.5n",      0x0000, 0x1000, 0x09acc978 )
  726.     ROM_LOAD( "5000.5m",      0x1000, 0x1000, 0xe571e959 )
  727.     ROM_LOAD( "5100.5l",      0x2000, 0x1000, 0x17ac9511 )
  728. ROM_END
  729.  
  730.  
  731.  
  732. GAME( 1981, bosco,    0,     bosco, bosco,   0, ROT0, "Namco", "Bosconian (new version)" )
  733. GAME( 1981, boscoo,   bosco, bosco, bosco,   0, ROT0, "Namco", "Bosconian (old version)" )
  734. GAME( 1981, boscoo2,  bosco, bosco, bosco,   0, ROT0, "Namco", "Bosconian (older version)" )
  735. GAME( 1981, boscomd,  bosco, bosco, boscomd, 0, ROT0, "[Namco] (Midway license)", "Bosconian (Midway, new version)" )
  736. GAME( 1981, boscomdo, bosco, bosco, boscomd, 0, ROT0, "[Namco] (Midway license)", "Bosconian (Midway, old version)" )
  737.